package birdsong.server;

import java.util.LinkedList;

public class ServerClient {


	private String nickName;

	private LinkedList<ServerClient> followers;


	public ServerClient(String nickName) {


		this.nickName=nickName;

		followers= new LinkedList<ServerClient>();

	}

	public void addFollower(ServerClient client){

		followers.add(client);

	}

	public void removeFollower(ServerClient client){
		if(!followers.isEmpty())
			followers.remove(client);
	}


	public LinkedList<ServerClient> getFollowers() {
		return followers;
	}


	public String getNickName() {



		return nickName;
	}

	@Override
	public String toString() {
		return "ServerClient [nickName=" + nickName + ", followers="
		+ followers()+ "]";
	}


	private String followers() {
		String x = "";

		for (ServerClient client : followers) {
			x+=client.getNickName()+", ";
		}
		return x;
	}


}
